
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="/struts-tags" prefix="struts"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>用户信息</title>
		<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
		<style type="text/css">
			<!--
			body {
				background-color: #aed4ff;
			}
			-->
		</style>
		
		<script>
		
			function isEmail(str) {
				var myReg = /^[-_A-Za-z0-9]+@([_A-Za-z0-9]+\.)+[A-Za-z0-9]{2,3}$/;
				if (myReg.test(str))
					return true;
				return false;
			}

			function isNumberOr_Letter(s) {//判断是否是数字或字母 

				var regu = "^[0-9a-zA-Z\_]+$";
				var re = new RegExp(regu);
				if (re.test(s)) {
					return true;
				} else {
					return false;
				}
			}

			function isNull(str) {
				if (str == "")
					return true;
				var regu = "^[ ]+$";
				var re = new RegExp(regu);
				return re.test(str);
			}

			function verify() {
				if (isNull(document.getElementById("name_js").value)) {
					alert("名字不能为空");
					return false;
				} else if (!isNumberOr_Letter(document
						.getElementById("name_js").value)) {
					alert("名字只能为数字、字母、和下划线！");
					return false;
				} else if (!isEmail(document.getElementById("email_js").value)) {
					alert("email格式不对");
					return false;
				} else
					return true;

			}
		</script>
	</head>

	<body>
	<img src="/bookshop-online/image/bupt_user_info.jpg" width="216" height="257" hspace="200" vspace="150">
		<div style="margin: -400px 0px 0px 500px;">
			<struts:form action="userInfoAction_updateUserInfo">
				<struts:label value="更新用户信息"></struts:label>
				<struts:textfield name="m.name" label="账号（不可编辑）" id="name_js" value="%{#request.user.name}" readonly ="true"/>
				<struts:textfield name="m.email" label="邮件地址" id="email_js" value="%{#request.user.email}"/>
				<struts:textfield name="m.idcard" label="证件号码" id="idcard_js" value="%{#request.user.idcard}"/>
				<struts:textfield name="m.tel" label="电话" id="tel_js" value="%{#request.user.tel}"/>
				<struts:textfield name="m.address" label="地址" id="address_js" value="%{#request.user.address}"/>
				<struts:textfield name="m.postcode" label="邮编" id="postcode_js" value="%{#request.user.postcode}"/>
				<struts:textfield name="m.truename" label="真实姓名" id="truename_js" value="%{#request.user.truename}"/>
				 <struts:submit value="更新" onclick="return verify();"></struts:submit>
			</struts:form>
			<a href="/bookshop-online/index.jsp">返回</a>
		</div>
	</body>
</html>